<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" lay-reqtext="用户名称不能为空" placeholder="请输入用户名称" value="" class="layui-input input_box">
            <!-- <tip>填写自己管理账号的名称。</tip> -->
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">登录账号</label>
        <div class="layui-input-block">
            <input type="text" name="user" lay-verify="required" lay-reqtext="登录账号不能为空" placeholder="请输入登录账号" value="" class="layui-input input_box">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">登录密码</label>
        <div class="layui-input-block">
            <input type="password" name="pwd" lay-verify="required" lay-reqtext="登录密码不能为空" placeholder="请输入登录密码" value="" class="layui-input input_box">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">城市</label>
        <div class="layui-input-block">
            <input type="text" name="city" id="city" placeholder="请输入城市" value="" class="layui-input input_box">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">积分</label>
        <div class="layui-input-block">
            <input type="text" name="experience" placeholder="请输入积分" value="" class="layui-input input_box">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">评分</label>
        <div class="layui-input-block">
            <input type="text" name="score" placeholder="请输入评分" value="" class="layui-input input_box">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">职业</label>
        <div class="layui-input-block">
            <input type="text" name="classify" placeholder="请输入职业" value="" class="layui-input input_box">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">财富</label>
        <div class="layui-input-block">
            <input type="text" name="wealth" placeholder="请输入财富" value="" class="layui-input input_box">
        </div>
    </div>
    
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注信息</label>
        <div class="layui-input-block">
            <textarea name="remarks" class="layui-textarea input_box" placeholder="请输入备注信息"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">提交</button>
        </div>
    </div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="../../js/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script>
    layui.use(['form', 'miniRequest'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$,
            miniRequest = layui.miniRequest;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            let result = miniRequest.postData('Dataadmin/addNewData1', data.field, true);
            // console.info('result = ', result);
            if(result.code == 200){
                layer.msg(result.msg, {icon: 6})
                setTimeout(() => {
                    let iframeIndex = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(iframeIndex);
                }, 1500);
            }else{
                layer.msg(result.msg, {icon: 7})
            }

            return false;
        });

    });
</script>
</body>
</html>